#include <QDBusConnection>
#include <QCoreApplication>
#include <QDebug>

#include "dbus/DbusZappyServer.h"
#include "ZappyServer.h"

int
main( int argc, char **argv ) 
{
    QCoreApplication app( argc, argv );
    ZappyServer zapv4nossl;
    ZappyServer zapv4ssl;
    ZappyServer zapv6nossl;
    ZappyServer zapv6ssl;
    
    zapv4ssl.setSSL();
    zapv6ssl.setSSL();
    
    zapv6nossl.setIpv6();
    zapv6ssl.setIpv6();
    
    new DbusZappyServer( &zapv4nossl );
    QDBusConnection connection = QDBusConnection::sessionBus();
    connection.registerObject("/Server/ZappyServerIpv4NoSSL", &zapv4nossl);
    connection.registerService("com.ponay.ZappyServer");    
    
    new DbusZappyServer( &zapv4ssl );
    connection.registerObject("/Server/ZappyServerIpv4SSL", &zapv4ssl);
    connection.registerService("com.ponay.ZappyServer");
    
    new DbusZappyServer( &zapv6nossl );
    connection.registerObject("/Server/ZappyServerIpv6NoSSL", &zapv6nossl);
    connection.registerService("com.ponay.ZappyServer");
    
    new DbusZappyServer( &zapv6ssl );
    connection.registerObject("/Server/ZappyServerIpv6SSL", &zapv6ssl);
    connection.registerService("com.ponay.ZappyServer");
    
    return app.exec();
}
